package com.lb.reward;

import java.util.ArrayList;

/**
 * @author user
 */
public class Reward {

    //抽奖等级名
    private String reward;

    //抽奖概率
    private double rate;

    //抽奖名额限制数
    private int num;

    // 抽到同一等级用户队列
    private ArrayList rewardUidList = new ArrayList();

    //安慰奖
    private static final String normalReward = "normalReward";

    private Boolean isOverRewardnum = false;

    public Reward(String reward, double rate, int num) {
        this.reward = reward;
        this.rate = rate;
        this.num = num;
    }

    public void setReward(String reward) {
        this.reward = reward;
    }

    public void setRate(double rate) {
        this.rate = rate;
    }

    public void setNum(int num) {
        this.num = num;
    }

    public void setRewardUidList(ArrayList rewardUidList) {
        this.rewardUidList = rewardUidList;
    }

    public String getReward() {
        return reward;
    }

    public double getRate() {
        return rate;
    }

    public int getNum() {
        return num;
    }

    public ArrayList getRewardUidList() {
        return rewardUidList;
    }

    public String getRewardByUid(String uid) {
        if (isOverRewardnum) {
            return normalReward;
        }
        int index = rewardUidList.indexOf(uid) + 1;
        if (index > num) {
            isOverRewardnum = true;
            return normalReward;
        }
        return reward;
    }
}